Skip to content

fix(l2gersync): adapt isGERRemovedFromL2 scan to RPC eth_getLogs block-range cap - #1813

Merged
joanestebanr merged 2 commits into
developfrom
fix/l2gersync-max-block-range-1812
Sep 1, 2026
Merged

fix(l2gersync): adapt isGERRemovedFromL2 scan to RPC eth_getLogs block-range cap#1813
joanestebanr merged 2 commits into
developfrom
fix/l2gersync-max-block-range-1812

Conversation

@joanestebanr

Copy link
Copy Markdown
Collaborator

🔄 Changes Summary

  • isGERRemovedFromL2 scanned for a GER's UpdateRemovalHashChainValue removal event from the insert block (which can be arbitrarily far behind the head) to "latest" in a single open-ended eth_getLogs call.
  • Once the chain advanced past the RPC provider's block-range cap, that call failed with query exceeds max block range N on every single appender retry, logging an ERROR forever and never actually recovering a genuinely-removed GER.
  • scanRemovedGERs now parses that error via aggkitcommon.ParseMaxRangeFromError and retries chunked — no config parameter involved, the same adaptive pattern already used by L2EVMGERReader.GetRemovedGERsForRange and AgglayerBridgeL2Reader.fetchUnsetClaimsWithFallbackChunking/getUnsetClaimsInChunks.
  • The learned cap is cached on removalScanMaxRange so that, once learned, later retries skip straight to the chunked path instead of repeating the doomed unbounded call.
  • fetchRemovedGERsChunk recurses per-chunk (mirroring those siblings) so a chunk that is itself still too large keeps adapting instead of failing the whole scan outright.

⚠️ Breaking Changes

  • 🛠️ Config: none.
  • 🔌 API/CLI: none — internal only (downloaderSovereign.scanRemovedGERs/fetchRemovedGERsChunk).
  • 🗑️ Deprecated Features: none.

📋 Config Updates

  • None.

✅ Testing

  • 🤖 Automatic: added TestDownloaderSovereign_IsGERRemovedFromL2_RecoversFromMaxBlockRangeError (reproduces the max-range error and verifies the chunked recovery combines results across chunks) and TestDownloaderSovereign_IsGERRemovedFromL2_CachesLearnedMaxRangeAcrossCalls (proves a second call skips the doomed unbounded call once the cap is learned). Full l2gersync suite green, go vet clean, golangci-lint 0 issues.
  • 🖱️ Manual: reproduced against a live bali-82-op bridge-service node whose L1InfoTreeSync was still far behind head — the unbounded scan was failing every retry with this exact error; confirmed the chunked fallback resolves it.

🐞 Issues

🔗 Related PRs

📝 Notes

  • None.

@joanestebanr joanestebanr self-assigned this Aug 26, 2026
@joanestebanr joanestebanr added bug Something isn't working bridge labels Aug 26, 2026
@joanestebanr joanestebanr changed the title fix(l2gersync): adapt removal-event scan to RPC eth_getLogs block-range cap fix(l2gersync): adapt isGERRemovedFromL2 scan to RPC eth_getLogs block-range cap Aug 26, 2026
…ge cap

isGERRemovedFromL2 scanned for the GER removal event from the insert
block (which can be arbitrarily far behind the head) to "latest" in one
open-ended eth_getLogs call. Once the chain advanced past the RPC
provider's block-range cap, that call failed with "query exceeds max
block range N" on every single appender retry, logging an ERROR forever
and never actually recovering a genuinely-removed GER.

scanRemovedGERs now parses that error via ParseMaxRangeFromError and
retries chunked - the same adaptive, config-free pattern already used by
L2EVMGERReader.GetRemovedGERsForRange and AgglayerBridgeL2Reader's
fetchUnsetClaimsWithFallbackChunking/getUnsetClaimsInChunks - caching the
learned cap (removalScanMaxRange) so later retries skip the doomed
unbounded call, and recursing per-chunk (fetchRemovedGERsChunk) so a
chunk that is itself still too large keeps adapting.

Closes #1812

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@joanestebanr
joanestebanr force-pushed the fix/l2gersync-max-block-range-1812 branch from 7f3e35d to 3583743 Compare September 1, 2026 08:23
@joanestebanr
joanestebanr enabled auto-merge (squash) September 1, 2026 08:25
@joanestebanr
joanestebanr enabled auto-merge (squash) September 1, 2026 10:27
@joanestebanr
joanestebanr merged commit fe65832 into develop Sep 1, 2026
31 checks passed
@joanestebanr
joanestebanr deleted the fix/l2gersync-max-block-range-1812 branch September 1, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bridge bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: l2gersync: isGERRemovedFromL2 fails, error: failed to scan for GER removal events from block n: query exceeds max block range 100000

2 participants